package com.test.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.test.entity.User;
import com.test.service.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserServiceImpl userService;

    @GetMapping("/{uid}")
    public User getUserById(@PathVariable("uid") int uid){
        System.out.println("我被调用了");
        User byId = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getUid,uid));
        return byId;
    }
}
